package infb.modelo;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author inftel
 */
@Entity
@Table(name = "TELECITAS")
@NamedQueries({@NamedQuery(name = "Telecitas.findAll", query = "SELECT t FROM Telecitas t"), @NamedQuery(name = "Telecitas.findById", query = "SELECT t FROM Telecitas t WHERE t.id = :id"), @NamedQuery(name = "Telecitas.findByFecha", query = "SELECT t FROM Telecitas t WHERE t.fecha = :fecha")})
@SequenceGenerator(name="secuencia_telecitas",sequenceName="SECUENCIA_TELECITAS",allocationSize=1)
public class Telecitas implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID")
    @GeneratedValue(strategy=GenerationType.SEQUENCE,generator="secuencia_telecitas")
    private Integer id;
    @Lob
    @Column(name = "SONIDO")
    private byte [] sonido;
    @Column(name = "FECHA")
    @Temporal(TemporalType.DATE)
    private Date fecha;
    @JoinColumn(name = "MEDICO", referencedColumnName = "DNI")
    @ManyToOne(optional = false)
    private Medicos medico;
    @JoinColumn(name = "PACIENTE", referencedColumnName = "ID")
    @ManyToOne(optional = false)
    private Pacientes paciente;

    public Telecitas() {
    }

    public Telecitas(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public byte[] getSonido() {
        return sonido;
    }

    public void setSonido(byte [] sonido) {
        this.sonido = sonido;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public Medicos getMedico() {
        return medico;
    }

    public void setMedico(Medicos medico) {
        this.medico = medico;
    }

    public Pacientes getPaciente() {
        return paciente;
    }

    public void setPaciente(Pacientes paciente) {
        this.paciente = paciente;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Telecitas)) {
            return false;
        }
        Telecitas other = (Telecitas) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "infb.modelo.Telecitas[id=" + id + "]";
    }

}
